import Vue from 'vue'
import VueRouter from 'vue-router'

//引入组件
// import Login from '../views/Login.vue'
//你可以使用@符号  代表的是src  根目录
// import User from '@/views/sys/user/index.vue'

// 登录
import Login from '@/login/Login.vue'
// 导航栏
import Main from '@/components/root.vue'

import Home from '@/components/home/index.vue'
import Problem from '@/components/problem/index.vue'
import Contest from '@/components/contest/index.vue'
import Submit from '@/components/submit/index.vue'
import Comments from '@/components/comment/index.vue'
import Users from '@/components/users/index.vue'
//题目模块
import ProblemDetail from '@/components/problem/detail.vue'
import ProblemSave from '@/components/problem/problemSave.vue'
import ProblemCase from "@/components/problem/problemCase.vue"

//比赛模块
import ContestSave from "@/components/contest/contestSave.vue"
import ContestDetail from "@/components/contest/detail.vue"
import ContestProblemDetail from "@/components/contest/problemDetail.vue"
import ContestRank from "@/components/contest/rank.vue"
import ContestRegister from "@/components/contest/Register.vue"

//用户模块
 import UserDetail from '@/components/users/userDetail'
import Settings from '@/components/users/settings'
//评论
import CommentDetail from '@/components/comment/detail.vue'
import CommentSave from '@/components/comment/saveOrUpdate.vue'

//消息
import Notice from '@/components/users/notice'
//公告
import Announcement from '@/components/home/announcement'
// 将VueRouter 做为插件安装到Vue对象上，会在Vue上增加两个属性$router $route
Vue.use(VueRouter)
//配置路由信息
const routes=[
    {
        path:"",
        component: Login,
    },{
        path:"/login",
        component: Login
    },
    {
        // 榜单
        path:"/contest/rank/:id",
        name:"contestRank",
        component:ContestRank
    },{
        // id为题目与比赛的关联表主键
        path:"/main/contest/problem/:id/:contestId",
        name:"contestProblemDetail",
        component: ContestProblemDetail
    },
   {
    path: "/main",
    component: Main,
    name:"main",
    children: [
        {
            path:"",
            component: Home
        },{
            path:"home",
            name:"home",
            component: Home
        },{  //公告列表页面
            path:"home/announcement",
            name:"homeAnnouncement",
            component: Announcement
        },{  //题目模块
            path:"problem",
            name:"problem",
            component: Problem,

        },{
            path:"problem/detail/:id",
            name:"problemDetail",
            component: ProblemDetail
        },{ //文章保存/修改
            path:"problem/save",
            name:"problemSave",
            component:ProblemSave,
        },{   //题目测试用例
            path:"problem/case",
            name:"problemCase",
            component: ProblemCase
        },{
            path:"contest",
            name:"contest",
            component: Contest
        },{
            path:"contest/save",
            name:"contestSave",
            component: ContestSave
        },{
            path:"contest/detail/:id",
            name:"contestDetail",
            component: ContestDetail
        },{
            path:"contest/register",
            name:"contestRegister",
            component: ContestRegister,
        },{
            path:"status",
            name:"status",
            component:Submit
        },{
            path:"comment",
            name:"comment",
            component:Comments
        },{
            path:"comment/detail/:id",
            name:"commentDetail",
            component: CommentDetail,
        },{
            path:"comment/save",
            name:"commentSave",
            component: CommentSave,
        },{
            path:"users",
            name:"users",
            component: Users,
        },{
            path:"user/detail/:id",
            name:"userDetail",
            component: UserDetail,
        },{
            path:"user/notice",
            name:"notice",
            component: Notice
        },{
            path:"user/settings",
            name:"settings",
            component: Settings
        }
    ]
   }
];


const router=new VueRouter({
    routes  //  routes====>  "routes":routes
});


//导出路由对象
export default router;

